﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HyperPin_Database_Editor
{
    public partial class HPSoundSettings : HPSettingsPanel
    {
        static string iniMasterVolume = "Master_Volume";
        static string iniVideoVolume = "Video_Volume";
        static string iniSoundEffectsVolume = "Sound_FX_Volume";
        static string iniWheelVolume = "Wheel_Sound_Volume";

        public HPSoundSettings()
        {
            InitializeComponent();
        }

        public override void doLoadSettings()
        {
            trackMasterVolume.Value = readSettingInt(iniMasterVolume, 50);
            numericMasterVolume.Value = trackMasterVolume.Value;
            
            trackVideoVolume.Value = readSettingInt(iniVideoVolume, 50);
            numericVideoVolume.Value = trackVideoVolume.Value;
            
            trackSoundEffectsVolume.Value = readSettingInt(iniSoundEffectsVolume, 50);
            numericSoundEffectsVolume.Value = trackSoundEffectsVolume.Value;

            trackWheelVolume.Value = readSettingInt(iniWheelVolume, 50);
            numericWheelSoundVolume.Value = trackWheelVolume.Value;
        }

        public override void doSaveSettings()
        {
            writeSettingInt(iniMasterVolume, trackMasterVolume.Value);
            writeSettingInt(iniVideoVolume, trackVideoVolume.Value);
            writeSettingInt(iniSoundEffectsVolume, trackSoundEffectsVolume.Value);
            writeSettingInt(iniWheelVolume, trackWheelVolume.Value);
        }

        private void trackMasterVolume_Scroll(object sender, EventArgs e)
        {
            numericMasterVolume.Value = trackMasterVolume.Value;
        }

        private void trackVideoVolume_Scroll(object sender, EventArgs e)
        {
            numericVideoVolume.Value = trackVideoVolume.Value;
        }

        private void trackSoundEffectsVolume_Scroll(object sender, EventArgs e)
        {
            numericSoundEffectsVolume.Value = trackSoundEffectsVolume.Value;
        }

        private void trackWheelVolume_Scroll(object sender, EventArgs e)
        {
            numericWheelSoundVolume.Value = trackWheelVolume.Value;
        }

        private void numericMasterVolume_ValueChanged(object sender, EventArgs e)
        {
            trackMasterVolume.Value = (int)numericMasterVolume.Value;
        }

        private void numericVideoVolume_ValueChanged(object sender, EventArgs e)
        {
            trackVideoVolume.Value = (int)numericVideoVolume.Value;
        }

        private void numericSoundEffectsVolume_ValueChanged(object sender, EventArgs e)
        {
            trackSoundEffectsVolume.Value = (int)numericSoundEffectsVolume.Value;
        }

        private void numericWheelSoundVolume_ValueChanged(object sender, EventArgs e)
        {
            trackWheelVolume.Value = (int)numericWheelSoundVolume.Value;
        }

    }
}
